/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package assignemnt1;
import java.util.ArrayList;
/**
 *
 * @author Hansel-G
 */
public class GridView {
    char[][] cell;
    ProjModel pm = new ProjModel();
    int gridSize = 26;
    final int space = 10;
    ArrayList<Car> carArray = new ArrayList();
    
    public GridView() {
    }

      public char[][] gridViewSetup (int horLanes, int verLanes) {
        final int HGrid = 25;
        final int VGrid = 26;
        char[][] cell = new char [HGrid][VGrid];

        for (int i = 0; i < HGrid ; i++){
            for (int j = 0; j<VGrid; j++)
            cell[i][j] = ' ';
            

        }
        //construct the grid
        for (int i = 0; i < space; i++){
            cell[i][space] = '|';
            cell[space][i] = '-';
            cell[space + horLanes+1][i] = '-';
            cell[space + horLanes+1+i+1][space] = '|';
            cell[i][space + verLanes+1] = '|';
            cell[space][space + verLanes+1+i+1] = '-';
            cell[space + horLanes+1][space+verLanes+1+i+1] = '-';
            cell[space + horLanes+1+i+1][space+verLanes+1] = '|';
            

        }
            
         for (int i = 0; i < HGrid ; i++){
            for (int j = 0; j<VGrid; j++)
            System.out.print(cell[i][j]);
                            System.out.println();
        }
            
            return cell;
}
    //build the vertical street cars
    public void buildVerCars(char[][] cell, int count) {
         int middle = gridSize / 2;
         carArray.add(new Car(1, middle, true));
         Car c1 = carArray.get(0);
         c1.setXPos(count);
         c1.setYPos(gridSize / 2);
         cell[c1.getXPos()][c1.getYPos()] = 'c';

    }
    //build the horizontal street cars
    public void buildHorCars(char[][] cell, int count) {
         int middle = gridSize / 2;
         carArray.add(new Car(middle,1, false));
         Car c1 = carArray.get(0);
         c1.setXPos(gridSize / 2);
         c1.setYPos(count);
         cell[c1.getXPos()][c1.getYPos()] = 'c';
    }
}
